package com.cn.wanxi.dao.impl;

import com.cn.wanxi.dao.CompanyDao;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.util.JDBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.TransferQueue;

public class CompanyImpl implements CompanyDao {
    @Override
    public CompanyModel getCompanyModel() {
        String sql = "select * from company where is_show=1";
        ResultSet resultSet = JDBC.find(sql);
        CompanyModel companyModel = new CompanyModel();
        try {
            while (resultSet.next()) {
                companyModel = new CompanyModel();
                companyModel.setId(resultSet.getInt("id"));
                companyModel.setLogo(resultSet.getString("logo"));
                companyModel.setPhone(resultSet.getString("phone"));
                companyModel.setAd(resultSet.getString("ad"));
                companyModel.setNet(resultSet.getString("net"));
                companyModel.setEmail(resultSet.getString("email"));
                companyModel.setLinePhone(resultSet.getString("line_phone"));
                companyModel.setAddress(resultSet.getString("address"));
                companyModel.setVersion(resultSet.getString("version"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return companyModel;
    }

    @Override
    public int add(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int del(CompanyModel companyModel) {
        return 0;
    }

    @Override
    public int update(CompanyModel companyModel) {
        return 0;
    }
}
